package apache;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerService {
	public void serverStart(int port) {
		try {
			ServerSocket serversocket = new ServerSocket(port);
			while (true) {
				Socket socket = serversocket.accept();
				new Processor(socket).start();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {

		int port = 80;
		if (args.length > 0) {
			port=Integer.parseInt(args[0]);
		}
		new ServerService().serverStart(port);

	}
}
